#ifndef MYGIS_H
#define MYGIS_H

#include <QtGui/QMainWindow>
#include <QtGui/QTableWidget>
#include <QtGui/QTableWidgetItem>
#include <QtGui/QtEvents>
#include <QtCore/QTime>
#include "ui_MyGIS.h"
#include "Satellite2D.h"

//#include "MultiCast.h"

class MyGIS : public QMainWindow
{
	Q_OBJECT

public:
	MyGIS(QWidget *parent = 0, Qt::WFlags flags = 0);
	~MyGIS();
	
private:
	void initUi();
	void ConvertToHMS(double time,int &hh,int &mm, int &ss);
	bool SaCalcNowTimeLeft(int rowidx,double time,int &hh,int &mm, int &ss);
	bool SaCalcNextTimeLeft(int rowidx,double time,int &hh,int &mm, int &ss);
	bool PlaceCalcNowTimeLeft(int rowidx,double time,int &hh,int &mm, int &ss);
	bool PlaceCalcNextTimeLeft(int rowidx,double time,int &hh,int &mm, int &ss);
	int  QTimeConvertToSec(QTime time);
	void setMark(double lon, double lat, const string& text);

private:
	Ui::MyGISClass ui;

	Satellite2D*	_satellite2D;
	QTimer*			_timer;
	OsgViewerBase*	_viewer;
	//CMultiCast		_send;

	QTableWidget *SatelliteTable,*PlaceTable;
	int SaNowLeftTime[10],SaNextLeftTime[10];
	int PlaceNowLeftTime[10],PlaceNextLeftTime[10];

private slots:
	void RefreshSaTable();
	void RefreshPlaceTable();
	void on_SatelliteTable_itemClicked(QTableWidgetItem* item);
	void on_PlaceTable_itemClicked(QTableWidgetItem* item);
};

#endif // MYGIS_H
